<template>
  <div>
    <ul>
      <li v-for="item in goodsList" :key="item.id" @click="about(item.id)">
        <img :src="item.list_pic_url" alt="" />
        <div class="van-ellipsis">
          {{ item.name }}
        </div>
        <div class="price">
          {{ item.retail_price | RMBformat }}
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import { Dialog } from "vant";
export default {
  name: "Products",
  props: ["goodsList"],
  methods: {
    about(num) {
      this.$router.push({name:"About",params:{id:num}})
      // // 很多商品信息不全 跳过去会报错 给了请求超时

      // Dialog.alert({
      //   message: "请求超时",
      // });
    },
  },
};
</script>

<style lang='less'  scoped>
/* @import url(); 引入css类 */
ul {
  padding: 0.1rem 2%;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  li {
    width: 49%;
    margin-bottom: 0.1rem;
    background: #fff;
    text-align: center;
    line-height: 0.5rem;
    .price {
      color: darkred;
    }
    img {
      display: block;
      width: 100%;
    }
  }
}
</style>